{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# CANN_API_SUM"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "vscode": {
     "languageId": "plaintext"
    }
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import plotly.offline as pyo\n",
    "\n",
    "from IPython.display import display, HTML\n",
    "\n",
    "import cluster_display\n",
    "\n",
    "display(HTML(\"<style>.container { width:100% !important; }</style>\"))\n",
    "pd.set_option('display.max_columns', None)\n",
    "pd.set_option('display.max_rows', None)\n",
    "pyo.init_notebook_mode()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "## 集群场景CANN层API统计分析\n",
    "该分析脚本展示了集群场景的统计数据分析结果。需要注意以下几点：\n",
    "1. 所有的时间信息单位是微秒(us);\n",
    "2. Q1表示单个API耗时的25%分位数，最终结果取自所有卡的Q1值中最小值；\n",
    "3. Q3表示单个API耗时的75%分位数，最终结果取自所有卡的Q3值中最大值；\n",
    "4. 'minRank'展示了API最小耗时所在卡；\n",
    "5. 'maxRank'展示了API最大耗时所在卡。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.read_csv(\"all_stats.csv\")\n",
    "display(df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "cluster_display.display_box(df, xaxis_title=\"name\", yaxis_title=\"duration (ns)\")\n",
    "cluster_display.display_stats_scatter(df, xaxis_title=\"name\", yaxis_title=\"duration (ns)\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "per_rank_df = pd.read_csv(\"rank_stats.csv\")\n",
    "cluster_display.display_stats_per_operation(per_rank_df, box=False, scatter=False)"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
